# 1.3 𝒏次插值Newton形式

n = 5
x = [0.4, 0.55, 0.65, 0.8, 0.9]
y = [0.41075, 0.57815, 0.69675, 0.88811, 1.02652]
xx = 0.6
w = 1
v = y
yy = y[0]
for k in range(1, n):
    for i in range(k):
        v[k] = (v[i] - v[k]) / (x[i] - x[k])
        w *= (xx - x[k - 1])
        yy += w * v[k]

print("y_predict= %.4f" % yy)
